#include "unittest2.h"
void testGainCard(struct gameState* state, int player){
    int result;
    int failed_tests = 0;
    result = gainCard(smithy,state,2,player);
    if(result!=0 || state->handCount[player]<=5){
        printf("Failed test for adding a card to the hand for player %i\n",player);
        failed_tests+=1;
    }
    result = gainCard(sea_hag,state,2,player);
    if(result==0){
        printf("Failed on adding a card that is not in play!");
        failed_tests+=1;
    }
    
    result = gainCard(remodel,state,0,player);
    int preDiscard = state->discardCount[player];
    
    if(result!=0 || state->discardCount[player] == preDiscard){
        printf("Test failed for discarding card for player %i \n.",player);
        failed_tests+=1;
    }
    
    result = gainCard(baron,state,1,player);
    int preDeckCount = state->deckCount[player];
    if(result !=0 || state->deckCount[player]==preDeckCount){
        printf("Failed test for incrementing deck count for player %i. \n",player);
        failed_tests+=1;
    }
    
    if(failed_tests==0){
        printf("All tests passed for testGainCard.\n");
    }
    else{
        printf("Number of tests failed for testGainCard %i .\n",failed_tests);
    }
}
int main(int argc, char** argv){
    int cards[10] = {adventurer, council_room, feast, gardens, mine,
        remodel, smithy, village, baron, great_hall};
    
    struct gameState* game =newGame();
    int initialized = initializeGame(2,cards,42,game);
    if(initialized!=-1){
        testGainCard(game,0);
    }
    return 0;
    
}